//
//  ClassifyTableViewCell.m
//  JiuJiuShangCheng
//
//  Created by jiujiukeji on 2018/7/19.
//  Copyright © 2018年 jiujiukeji. All rights reserved.
//

#import "ClassifyTableViewCell.h"

@implementation ClassifyTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setUpUI];
    }
    return self;
}
- (void)setUpUI
{
    WeakSelf
    self.goodsImg = [[UIImageView alloc] init];
    _goodsImg.image = UIImageNamed(@"salesGoods");
    [self addSubview:_goodsImg];
    [_goodsImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(rateWidth(20));
        make.centerY.equalTo(self);
        make.size.mas_offset(CGSizeMake(rateHeight(200), rateHeight(200)));
    }];
    self.titleLB = [UILabel labelWithText:@"商品标题商品标题商品标题商品标题" textColor:UIColorFromRGB(0x333333) fontSize:14];
    [_titleLB sizeToFit];
    _titleLB.numberOfLines = 0;
    [self addSubview:_titleLB];
    [_titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.goodsImg.mas_right).offset(rateWidth(20));
        make.top.equalTo(weakSelf.goodsImg).offset(rateHeight(10));
        make.width.mas_lessThanOrEqualTo(@(rateWidth(300)));
        make.height.mas_lessThanOrEqualTo(@(rateHeight(80)));
    }];
    self.describeLB = [UILabel labelWithText:@"商品描述" textColor:UIColorFromRGB(0x666666) fontSize:12];
    [_describeLB sizeToFit];
    _describeLB.numberOfLines = 0;
    [self addSubview:_describeLB];
    [_describeLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.titleLB);
        make.top.equalTo(weakSelf.titleLB.mas_bottom).offset(rateHeight(10));
        make.width.mas_lessThanOrEqualTo(@(rateWidth(300)));
        make.height.mas_lessThanOrEqualTo(@(rateHeight(80)));
    }];
    self.priceLB = [UILabel labelWithText:@"￥119.00" textColor:navBarColor fontSize:17];
    [_priceLB sizeToFit];
    [self addSubview:_priceLB];
    [_priceLB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.titleLB);
        make.top.equalTo(weakSelf.describeLB.mas_bottom).offset(rateHeight(20));
    }];
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = globalGray;
    [self addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self);
        make.height.equalTo(@(0.5));
    }];
}

@end
